package com.example.mall.domain;

import java.util.Date;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.example.mall.util.CodeGenerateUtils;

import java.io.Serializable;

/**
 * <p>
 * 商品库存表
 * </p>
 *
 * @author whale
 * @since 2025-05-06
 */
@TableName("tb_product_inventory")
public class ProductInventory extends Model<ProductInventory> {

    private static final long serialVersionUID = 1L;

    /**
     * 库存唯一标识
     */
    @TableId("inventory_id")
    private Long inventoryId;
    /**
     * 商品id
     */
    @TableField("product_id")
    private Long productId;
    /**
     * 规格id
     */
    @TableField("spec_id")
    private Long specId;
    /**
     * 库存数量
     */
    private Integer stock;
    /**
     * 创建时间
     */
    @TableField("create_time")
    private Date createTime;
    /**
     * 更新时间
     */
    @TableField("update_time")
    private Date updateTime;

    public ProductInventory() {
        this.inventoryId = Long.valueOf(CodeGenerateUtils.generateUniqueId());
    }

    public Long getInventoryId() {
        return inventoryId;
    }

    public void setInventoryId(Long inventoryId) {
        this.inventoryId = inventoryId;
    }

    public Long getProductId() {
        return productId;
    }

    public void setProductId(Long productId) {
        this.productId = productId;
    }

    public Long getSpecId() {
        return specId;
    }

    public void setSpecId(Long specId) {
        this.specId = specId;
    }

    public Integer getStock() {
        return stock;
    }

    public void setStock(Integer stock) {
        this.stock = stock;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    @Override
    public String toString() {
        return "ProductInventory{" +
        ", inventoryId=" + inventoryId +
        ", productId=" + productId +
        ", specId=" + specId +
        ", stock=" + stock +
        ", createTime=" + createTime +
        ", updateTime=" + updateTime +
        "}";
    }
}
